package learn.design.patterns.E_Builder.BuilderWithEnum;

import lombok.Getter;
// 枚举建造者模式（Builder with Enum）:
@Getter
public class EnumComputer {
    private final String processor;
    private final String ram;
    private final String hardDrive;
    private final String type;

    private EnumComputer(String processor, String ram, String hardDrive, String type) {
        this.processor = processor;
        this.ram = ram;
        this.hardDrive = hardDrive;
        this.type = type;
    }

    // 枚举建造者
    public enum Builder {
        GAMING {
            @Override
            EnumComputer build(String processor, String ram, String hardDrive) {
                return new EnumComputer(processor, ram, hardDrive, "Gaming");
            }
        },
        OFFICE {
            @Override
            EnumComputer build(String processor, String ram, String hardDrive) {
                return new EnumComputer(processor, ram, hardDrive, "Office");
            }
        };

        abstract EnumComputer build(String processor, String ram, String hardDrive);
    }
}
